import React from "react";

class App extends React.Component {
	constructor(props) {
		super(props);//传递props，在constructor中才能获取到this.props
		this.state = {type:"类",id:100}
		setTimeout(()=>{
			this.setState({type:"函数"})
		},2000)
		console.log("constructor");
	}
	componentDidMount() {
		console.log("componentDidMount");
	}
	shouldComponentUpdate() {
		console.log("shouldComponentUpdate");
		return true;
	}
	componentDidUpdate() {
		console.log("componentDidUpdate");
	}
    render() {
		console.log("render");
		return <h1>{this.state.type}组件</h1>
	}
}

export default App;